﻿using System;
using System.Collections.Generic;
using System.Text;
using PixelReplacer;
using System.Drawing;

namespace ReplacerTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Replacer r = new Replacer();
            VektorRecogniser vr = new VektorRecogniser();
            PixelRule pr = new PixelRule();

            Bitmap img = (Bitmap)Bitmap.FromFile("android_apps.jpeg");

            pr.Name = "Android Green";
            pr.A = new PixelRange(0, 256);
            pr.R = new PixelRange(50, 150);
            pr.G = new PixelRange(100, 200);
            pr.B = new PixelRange(0, 60);
            pr.AdaptColors = true;
            pr.AdaptValue = 100;
            pr.NewColor = Color.FromArgb(0xFF0000);

            vr.Rules.Add(pr);
            vr.RealColor = true;

            r.Rules.Add(pr);
            r.Picture = (Bitmap)img.Clone();
            vr.Picture = (Bitmap)img.Clone();

            Console.Write("recognize...");
            r.Recognize();
            Console.WriteLine("ok!");

            Console.Write("vector...");
            vr.Recognize();
            Console.WriteLine("finished!");

            vr.Overlay.Save("overlay.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
            r.Picture.Save("result.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
        }
    }
}
